<template>
	<div>
		<!--配送时间-->
		<!--<div class="aui-content">
            <ul class="aui-list lightred_bj">
                <li class="aui-list-item">
                    <div class="aui-list-item-label-icon">
                        <i class="icon njfont nj-shijian"></i>
                    </div>
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">送达时间：<span id="name">今天  上午</span></div>
                        <div class="aui-list-item-right">
                            <div  class="aui-label aui-label-danger aui-label-outlined" @click="chooseTime">更改</div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>-->
		<!--配送时间 end-->
		<!--商品列表-->
		<!--<div class="aui-content choose_list" >
            <ul class="aui-list aui-media-list">
                <li class="aui-list-item iscroll_list">
                    <div id="co_orderGoods" class="aui-media-list-item-inner scroller_list">
						<div class="aui-list-item-media" v-for="item in cartList">
							<img :src="goodsImg(item)"/> 
							<em>{{item.goodsNum}}</em>
						</div>
                    </div>
                </li>
            </ul>
            <div class="aui-list-item-arrow statistics" @click="goInfomation">
                <p>共<span id="co_totalPiece">{{num}}</span>件</p>
                <p id="co_totalPackage">1个包裹</p>-->
		<!--<p id="co_totalPackage">常规配送</p>-->
		<!--</div>
        </div>-->
		<!--商品列表 end-->
		<!--信息列表-->
		<div class="aui-content aui-margin-b-15">
			<ul class="aui-list aui-list-in">
				<!-- <li class="aui-list-item aui-list-item-arrow">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title">优惠券</div>
                        <div class="aui-list-item-right">新人券</div>
                    </div>
                </li> -->
				<!-- <li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-title">商品金额</div>
						<div id="co_totalMoney" class="aui-list-item-right">¥{{Number(goodsMoney).toFixed(2)}} <span v-if="addMoney">(含加工费：¥{{addMoney}})</span></div>
					</div>
				</li> -->
				<!-- <li class="aui-list-item aui-list-item-arrow" v-if="false">
					<div class="aui-list-item-inner" @click="showGiftCard">
						<div class="aui-list-item-title">我的钱包</div>
						<div class="aui-list-item-right">{{getUseGiftCard?'已选择':''}}</div>
					</div>
				</li> -->
				<li class="aui-list-item aui-list-item-arrow">
					<div class="aui-list-item-inner" @click="showCoupon">
						<div class="aui-list-item-title" style="color:#9a9a9a;">优惠</div>																											<!--ticketList-->
						<div class="aui-list-item-right" style="color:#444;">
                            {{couponFlag}}
                            <!-- <span style="color: #EF5423;padding-right: 0.1rem;" v-if="getTicketList.length === 0 && couponCount">{{couponCount}}</span> -->
                        </div>
					</div>
				</li> 
				
				<!-- <li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-title">优惠金额</div>
						<div id="co_totalMinis" class="aui-list-item-right">¥{{couponM?couponM.toFixed(2):'0'}}</div>
					</div>
				</li> -->
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-title" style="color:#9a9a9a;">赠品加价</div>
						<div id="co_totalMinis" class="aui-list-item-right" style="color:#444;">¥{{goodsAddMoney?goodsAddMoney.toFixed(2):'0'}}</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-title" style="color:#9a9a9a;">配送费</div>
						<div id="co_totalMinis" class="aui-list-item-right" style="color:#444;">¥{{freight}}</div>
					</div>
				</li>
			</ul>
		</div>
		<!--信息列表 end-->
		<div class="aui-content aui-margin-b-15" v-if="false">
			<ul class="aui-list aui-form-list liuyan">
                <li class="aui-list-item">
                    <div class="aui-list-item-inner" style="align-items:flex-start;">
                        <div class="aui-list-item-label" style="line-height:2rem;">买家留言：</div>
                        <div class="aui-list-item-input">
                            <textarea placeholder="选填：输入留言信息" ref="note" id="confirmOederNode" v-model="myNode" maxlength="100"></textarea>
                        </div>
                    </div>
                </li>
            </ul>
		</div>
		<div class="total_sf" v-if="false">
			<h2><span id="co_realpay" >实付金额：¥ {{Number(money).toFixed(2)}}</span> <p style="display: inline;" v-if="false">(省：¥ 1.00)</p> </h2>
			<p>如需发票，请到门店索取</p>
		</div>
		<!--立即下单-->
		<!-- <div style="height:4rem;" id="scrollTopBox"></div> -->
		<!-- <div class="aui-btn aui-btn-danger aui-btn-block aui-btn-sm zxSettle_acount">
			<div style="font-size: 1rem;" @click.stop="test">提交订单</div>
		</div> -->
		<!--去结算 end-->
		<confirm-coupon ref="coupon" v-if="couponArr && couponArr.length"  :couponArr="couponArr" :couponArrHtm="couponArrHtm" :couponMoney="couponM" :money="totalMoney" :getCouponMoney="getMoneyAgain"></confirm-coupon>
		<confirm-gift-card ref="giftCard" :giftCardList="giftCardList"></confirm-gift-card>
	</div>
</template>

<script>
	import { mapMutations, mapGetters } from 'vuex';
	import {MessageBox} from '../../../ui-components';
	import ConfirmCoupon from "../ConfirmOrderCoupon";
	import ConfirmGiftCard from "../ConfirmGiftCard";
	import axios from "axios";
	import { Toast } from "../../../utils/toast";
	import {showLoading, hideLoading} from "../../../utils/loading";
	export default {
		props: {
			sendOrder: {
				type: Function,
				default: () => {}
			},
			checkedCartList: {
				type: Array,
				default: function() {
					let arr = [];
					return arr
				}
			},
			normalList: {
				type: Array,
				default: function() {
					let arr = [];
					return arr
				}
			},
			bigList: {
				type: Array,
				default: function() {
					let arr = [];
					return arr
				}
			},
			sendMoney: {
				type: Array,
				default: function() {
					let arr = [];
					return arr
				}
			},
		},
		computed: {
			...mapGetters('zx', [
				"getTicketList","getUseGiftCard","getMynode"
			]),
			...mapGetters('cjy', [
				"selectGiftList", "selectLadderList", "buyMoreData"
			]),
			ticketList() {

			},
			freight() {
				return this.freightM; //运费
			},
			totalMoney() {
				return this.money;
			},
            changeGoodsMoney(){
                return this.goodsMoney;
            },
			couponM() {
				return this.couponMoney; //总优惠金额
			},
			node() {
				//console.log('*&&*&*&*&*&*&*&*&*')
				return this.mynode;
			}
		},
		components: {
			"ConfirmCoupon": ConfirmCoupon,
			"ConfirmGiftCard":ConfirmGiftCard
		},
		data() {
			return {
				myNode: '',
				cartList: [],
				listNormal: [],
				listBig: [],
				num: null,
				goodsMoney: null, //商品金额
				money: null, //总金额 //应付金额
				normalMoney: null, //常规商品金额
				bigMoney: null, //大件商品金额
				addMoney: null, //加工费用
				minNormalMoney: null, //常规最小免配送费用
				minBigMoney: null, //大件最小免配送费用
				normalM: null, //常规的运费
				bigM: null, //大件的运费
				normalMFlag: false, // 是否加运费
				bigMFlag: false, // 是否加运费
				freightM: 0, //最终运费
				couponArr: null,
				couponArrHtm: null, //用于渲染的优惠券
				couponFlag: '', //是否选择优惠券
				couponCount:0,  // 优惠券组合个数
				couponMoney: 0, //总优惠金额
				goodsAddMoney:0,//赠品加价
				giftList: [], // 购物车活动
				ladderList: [], // 购物车活动
				giftCardList:[],  //礼品卡列表
				walletStatus:0,   // 是否已经设置钱包密码
				moneyWithoutCode:0, // 钱包免密金额
                scrollAnim:null, //买家留言定时器
                discountMoneyByCoupon:0, //优惠券优惠
                afterPromTotalMoney:0, //其他优惠
			}
		},
		methods: {
			...mapMutations('zx', [
				"setMynode", "setNormalM", "setBigM", "setLadderIdList", "setGiftVOList","setGiftSendArr","setToken","setOrderFlag"
			]),
			goInfomation() {
				this.$router.push('orderInformation');
			},
			//获取购物车商品活动信息
			getSelectGiftList() {

				var arr = this.selectGiftList; // 满增阶梯
                console.log(this.selectGiftList,'满增阶梯000111')
				if(arr && arr.length != 0) {
					for(var i = 0; i < arr.length; i++) {
						
						//如果存在goodsCode就传goodsCode 如果不存在goodsCode但是存在goodsCodeList就便利之后传过去
						if(arr[i].goodsCode){
							var newArr = [];
							newArr.push(arr[i].goodsCode);   //商品code
							newArr.push(arr[i].promLadderId);    // 阶梯满id
							newArr.push(arr[i].promCode);  //活动code
							this.ladderList.push(JSON.stringify(newArr));
							
						}else if(arr[i].goodsCodeList && arr[i].goodsCodeList.length){
							
							for(let j = 0; j < arr[i].goodsCodeList.length; j++) {
								var newArr = [];
								newArr.push(arr[i].goodsCodeList[j]);  //商品列表
								newArr.push(arr[i].promLadderId);  // 订单返利 阶梯满id 
								newArr.push(arr[i].promCode);      // 活动code
								this.ladderList.push(JSON.stringify(newArr));
							}
							
						}
					}
					this.setLadderIdList(this.ladderList);
				}
			},
			getSelectLadderList() {
				var arr = this.selectLadderList; // 返利阶梯   只有订单返利阶梯才有可能送单张优惠券
                console.log(this.selectLadderList,'返利阶梯000111')
				if(arr && arr.length != 0) {
					for(var i = 0; i < arr.length; i++) {
						
						//newArr.push(arr[i].goodsList);
						for(let j = 0; j < arr[i].goodsList.length; j++) {
							var newArr = [];
							newArr.push(arr[i].goodsList[j]);  //商品列表
							newArr.push(arr[i].promLadderId);  // 订单返利 阶梯满id 
							newArr.push(arr[i].promCode);      // 活动code
							this.ladderList.push(JSON.stringify(newArr));
						}
					}
					//					console.log(this.ladderList,'阶梯参数');
				}
				this.setLadderIdList(this.ladderList);
			},
			getBuyMoreData() {
				//每满 不累计   判断 couponvo 和  giftcouponlist  都没有值 就传给后台
//				giftCouponList  couponVO
				var arr = this.buyMoreData;
				
				var giftVoList = arr.filter ( (item) => {
					return item.giftVO && item.giftVO.giftGoodsList && item.giftVO.giftGoodsList.length > 0
				})
				console.log(giftVoList,'giftVoList5555555555')
				if(giftVoList.length != 0) {
					for(var i = 0; i < giftVoList.length; i++) {
						for(let j = 0; j < giftVoList[i].goodsList.length; j++) {
							var newArr = [];
							newArr.push(giftVoList[i].goodsList[j]);
							newArr.push(giftVoList[i].promCode);
							newArr.push(giftVoList[i].selectNum);
							if(giftVoList[i].selectNum != 0) {
								this.giftList.push(JSON.stringify(newArr));
							}

						}
                    }
				}
				console.log(this.giftList,'777噢噢噢噢噢噢噢噢噢噢噢噢噢噢噢噢噢噢噢噢哦哦哦 ')
                
				this.setGiftVOList(this.giftList);
			},
			//获取购物车商品活动信息结束

			//获取优惠券信息
			getCoupon() {
				let url = window.api.trade_host + "/marketCenter/getCalCart/" + window.localStorage.getItem('storeCode') + "/false"
				let config = {
					url: url,
					method: "GET",
					headers: {
						'sessionId': window.localStorage.getItem("sessionId")
					}
				};
				axios(config).then((res) => {
					if(res.data.data[0] && res.data.returnCode == 1) {
//						console.log(res.data.data[0].calculationVO.prodVoList,'商品列表')
						
						if(res.data.data[0].couponListCanBeUsed && res.data.data[0].couponListCanBeUsed.length){
							var arr = res.data.data[0].couponListCanBeUsed;	
							this.couponCount = res.data.data[0].couponListCanBeUsed.length;
						}
//						console.log(res.data.data[0].couponListCanBeUsed.length);
//						console.log(arr, '原生数组')
						this.couponArr = this.newCoupons(arr, 1);
                        this.couponArrHtm = this.newCoupons(arr, 2);
					}
					
					//如果没有可使用的优惠券 或者 没有获取到优惠券信息 则直接调用获取金额信息接口    如果有可使用的优惠券 则在优惠券组件中获取最优优惠券再请求获取金额信息接口
					if(!res.data.data[0] || !res.data.data[0].couponListCanBeUsed || this.couponCount == 0){
						this.getMoneyAgain(true); // 第一次调用金额接口
					}
					
					//					console.log(this.money,'实付金额');
					//					console.log(this.couponMoney,"优惠金额");
					//					console.log(this.goodsMoney,"商品金额");
				})
			},
			//过滤优惠券
			newCoupons(arr, num) {
                console.log(arr,'0000')
				var newArr = [];
				if(arr) {
					for(let i = 0; i < arr.length; i++) {
						for(let j = 0; j < arr[i].couponCodeList.length; j++) {
							arr[i].couponCodeList[j].relIndex = i;
							newArr.push(arr[i].couponCodeList[j]);
						}
					}
				}
				console.log(newArr, '过滤后');
				if(num === 1) {
					return newArr;
				} else if(num === 2) {
					return arr;
				}
			},
			//展示优惠券
			showCoupon() {
				//	        	console.log("sss")
				if(this.couponCount){
                    this.$refs.coupon.showCover()
                }else{
                    Toast({
                        message: '暂无优惠券',
                        type: "warn",
                        duration: 1000
                    });
                }
			},
			showGiftCard(){
				if(this.walletStatus == 1){
					this.$refs.giftCard.showCover();
				}else{
					MessageBox.confirm('去设置支付密码').then((action)=>{
		            	console.log(action);
		            	this.$router.push('SetKeyWallet');
		            })
				}
				
			},
			//获取起配费用
			getMinSendM() {
				for(let i = 0; i < this.sendMoney.length; i++) {
					if(this.sendMoney[i].deliveryType === 0) {
						this.minNormalMoney = this.sendMoney[i].startingAtAmount;
						this.normalM = this.sendMoney[i].deliveryFees;
					} else if(this.sendMoney[i].deliveryType === 1) {
						this.minBigMoney = this.sendMoney[i].startingAtAmount;
						this.bigM = this.sendMoney[i].deliveryFees;
					}
                }
                this.checkeMoneySend(); //之前未调用  5.9增加
				console.log(this.minNormalMoney, this.normalM, this.minBigMoney, this.bigM,'******');
			},

			//判断是否需要加运费
			checkeMoneySend() {
				//				console.log("**********************************************************")
				if(this.listNormal.length > 0) {
					if(this.normalMoney < this.minNormalMoney) {
						console.log(this.minNormalMoney, '显示金额3');
						//获取总金额
						let m = Number(this.normalM);
						this.money += m;

						//存运费信息
						let obj = {};
						this.normalMFlag = true;
						obj.normalM = this.normalM;
						obj.normalMFlag = this.normalMFlag;
						this.setNormalM(obj);
					}
				}
				if(this.bigList.length > 0) {
					if(this.bigMoney < this.minBigMoney) {
						//获取总金额
						let m = Number(this.bigM);
						this.money += m;
						//存运费信息
						let obj = {};
						this.bigMFlag = true;
						obj.bigM = this.bigM;
						obj.bigMFlag = this.bigMFlag;
						this.setBigM(obj);
					}
                }
                // console.log('计算运费了啊   啊啊  ')    
				this.getFreightM(); //用于展示的运费
			},
			getFreightM() {
				if(this.normalMFlag === true) {
					this.freightM += this.normalM;
				}
				if(this.bigMFlag === true) {
					this.freightM += this.bigM;
                }
			},
			innit() {
				this.cartList = this.checkedCartList;
				console.log(this.checkedCartList, '购物车数据');
				this.listNormal = this.normalList;
				this.listBig = this.bigList;
				//console.log(this.sendMoney,'自组建获取配送费用')
			},
			getCouponParams() {
				let arr = this.getTicketList;
//				console.log(arr,'优惠券——————————————————————————————————————————————————————————')
				let newArr = [];
				for(let i = 0; i < arr.length; i++) {
					newArr.push(arr[i].qrCode);
				}
				return newArr;
			},
			getToken(){
				let url =  window.api.trade_host + "/order/getToken";
				let config = {
					url: url,
					method: "GET",
					headers: {
						'sessionId': window.localStorage.getItem("sessionId")
					}
				};
				axios(config).then((res)=>{
					this.setToken(res.data.data[0]);
				})
				
			},
			//确定选择优惠券时，调取后台接口实时获取金额信息
			getMoneyAgain(flag) {
				//展示loading效果
			    showLoading();
				var arr = [];
				this.setGiftSendArr(arr); // 清空礼品包
				
				let url = window.api.trade_host + "/marketCenter/calOrder";
				let params = {
					storeCode: window.localStorage.getItem('storeCode'),
				};
				console.log(this.giftList, this.ladderList, "88888")
				params.qrCodeList = this.getCouponParams(); //优惠券集合 
				if(this.giftList && this.giftList.length != 0) {
					params.giftVOList = this.giftList; // 赠品id 商品id 活动id  赠品次数 以逗号分隔
				}
				if(this.ladderList && this.ladderList.length != 0) {
					params.ladderIdList = this.ladderList; //商品id 阶梯满id 活动id  以逗号分隔
                }
                // 是否是第一次调用该接口 true代表第一次调用  false代表第二次开始调用
                params.callFirstTime = flag;
				let config = {
					url: url,
					method: "POST",
					data: params,
					headers: {
						'sessionId': window.localStorage.getItem("sessionId")
					}
				};
				
				try{
	        		axios(config).then((res) => {
						// console.log(res.data.data[0], '选择优惠券后请求后台的参数');
						if(res.data.returnCode == 1) {
                            this.discountMoneyByCoupon = res.data.data[0].discountMoneyByCoupon; //优惠券优惠金额
                            this.afterPromTotalMoney = res.data.data[0].afterPromTotalMoney;//优惠活动优惠金额
                            // console.log(this.discountMoneyByCoupon,this.afterPromTotalMoney,'）））））））怎么没有货渠道优惠金额信息））））')
							this.money = Number(res.data.data[0].resultOrderTotalMoney); //应付金额
							this.couponMoney = Number(res.data.data[0].orderDiscountMoney); // 总优惠金额
							this.goodsMoney = Number(res.data.data[0].beforeDiscountMoney); //商品金额
							this.addMoney = Number(res.data.data[0].totalWorkingFee); // 加工费用
							this.normalMoney = Number(res.data.data[0].totalCgoodsFee); //常规商品费用
							this.bigMoney = Number(res.data.data[0].totalBgoodsFee); //大件商品费用
                            this.goodsAddMoney = Number(res.data.data[0].addMoney); //加价购
                            //暂时未用到的数据
                            let coupon = res.data.data[0].couponCodeUsedList; //最优优惠券组
                            
                            //暂时未用到的数据
                            this.setToken(res.data.data[0].token);//服务器token用于后台判断是否是第一次尝试下单
							// var giftArr = res.data.data[0].giftVOPresentList.concat(res.data.data[0].couponCodePresentList); //下面不展示赠品信息了只展示赠送的优惠券
                            // this.setGiftSendArr(giftArr);
                            //购物车商品数据 因为需求改动购物车数据不从购物车页面传递所以用发送事件的方式将商品数据发送给父组件
                            let commonGoodsList = res.data.data[0].commonGoodsList; //常规商品数组
                            let bigGoodsList = res.data.data[0].bigGoodsList; //大件商品数组
                            let goodsList = this.addDistrbution(commonGoodsList).concat(this.addDistrbution(bigGoodsList)); //增加了distributiontype属性的总商品数组
                            this.$emit('sendGoodsList',goodsList);

                            //获取可用优惠券信息
                            if(res.data.data[0] && res.data.data[0].coupounsList && res.data.data[0].coupounsList.length){
                                let coupounsList = res.data.data[0].coupounsList;	
                                this.couponCount = res.data.data[0].coupounsList.length;
                                this.couponArr = this.newCoupons(coupounsList, 1);
                                this.couponArrHtm = this.newCoupons(coupounsList, 2);
                                // console.log(coupounsList,this.couponArr,this.couponArrHtm,'…………………………优惠券数组打印*****8')
                            }
                            this.checkeMoneySend(); //每次获取到金额信息就判断是否需要加运费
							
						} else {
							Toast({
								message: '计算金额失败',
								type: "fail",
								duration: 1000
							});
						}
                        //隐藏loading效果
                        // 等待配送时间返回再隐藏loading
                        // setTimeout(() => {
                        // 	hideLoading();
                        // },1000)
					})	
        		}catch(err) {
        			//隐藏loading效果
					hideLoading();
        		}
				
            },
            //为常规商品和大件商品添加distrbution属性
            addDistrbution(arr){
                let newArr = [];
                arr.map((item,index) => {
                    item.distributiontype = item.goodsDeliveryType; //0 常规 1大件
                    newArr.push(item);
                })
                return newArr;
            },
			 //监听买家留言框的focus事件 开始
	        initTextareaFocusEvent() {
	            this.$refs.note.onfocus = () => {
	                console.log("input框框获取到了焦点");
	                this.initInputStyle();
	            }
	            this.$refs.note.onblur = () => {
	                console.log("失去焦点");
	                //重置样式
	                this.unsetStyle();
	                
	            }
	        },
	        //监听滑动事件
//	        listenOnblur(){
////	        	removeEventListener
//	        	var bo = document.getElementsByTagName('body')[0];
//	        	var that = this;
//	        	bo.addEventListener('touchstart', function(event) {
//	        		that.unsetStyle();
//	        	})
//	        },
//	        removeListenOnblur(){
//	        	var bo = document.getElementsByTagName('body')[0];
//	        	var that = this;
//	        	bo.removeEventListener('touchstart', function(event) {
//	        		
//	        	})
//	        },
	        //如果是安卓机,调整页面margin-bottom供用户看到input框
	        initInputStyle() {
	            let isAndroid = navigator.userAgent.indexOf("Android") > -1;
	            if (isAndroid) {
	            	console.log("/-*****-/---1---");
					let box = document.getElementById('nodeBug');
					let box2 = document.getElementById('scrollTopBox');
					box2.style.height = '18rem';
	                let scrollTopContainer = document.body;
//	                console.log(box.scrollTop,'11111111111')
					box.scrollTop = 450;
//					console.log(box.scrollTop,'11111111111')
	                //给一个scrollTop值的变化，自动滑上去
	                let distance = parseInt(getComputedStyle(box, null).marginBottom.slice(0, -2));
	                let duration = 200 / 16.7;
	                let speed = distance / duration;
	                this.scrollAnim = setInterval(() => {
	                    scrollTopContainer.scrollTop += speed;
	                    if (scrollTopContainer.scrollTop >= distance) {
	                    	console.log("/-*****-/---3---");
	                        scrollTopContainer.scrollTop = distance;
	                        clearInterval(this.scrollAnim);
	                    }
	                }, 16.7);
	            }
	        },
	        unsetStyle() {
//	        	console.log(999)
	            //清除计时器
	            clearInterval(this.scrollAnim);
	            this.scrollAnim = null;
	            let box = document.getElementById('nodeBug');
				let box2 = document.getElementById('scrollTopBox');
				box2.style.height = '4rem';
				box.scrollTop = 220;
				 console.log(box.scrollTop,'22222222222')
	        },
	        keyCodeEvent(event){
				var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
				if (isiOS) {
					return ;
				}
				if (event.keyCode === 13) {
					console.log('keyCode',13,'测试键盘码13');			
				}
				if (event.keyCode === 111) {
					console.log('keyCode',111,'测试键盘码111');			
				}
			},
			addKeyCodeEventListener() {
				window.addEventListener("keyup", this.keyCodeEvent.bind(this), false);
			},
			removeKeyCodeEventListener() {
				window.removeEventListener("keyup", this.keyCodeEvent.bind(this), false);
			},
	        //监听买家留言框的focus事件  结束
			test() {
				this.sendOrder();
			},
			//从支付页点返回处理
			checkPayBack(){
				let flag = this.$store.getters.getNativeBackFlagForPay;
				let flag2 = !this.$store.state.cjy.checkedCartList || this.$store.state.cjy.checkedCartList.length == 0;
				if(flag && flag2){
					this.$store.commit("setNativeBackFlagForPay", false);
					this.$router.push({path:'order',query:{orderStatus:1}});
					return true;
				}else if(!flag && flag2){
					this.$router.push('cart');
					return true;
				}
				return false;
			}
		},
		watch: {
			sendMoney(newVal, oldVal) {
				this.getMinSendM();
			},
			myNode(newVal, oldVal) {
				//console.log(newVal,oldVal,'用户留言');
				this.setMynode(newVal);
			},
			totalMoney(newVal,oldVal){
//				为确保数据同时渲染在请求完获取金额的接口后再显示优惠券信息
                // afterPromTotalMoney 其他优惠金额  discountMoneyByCoupon优惠券优惠金额 couponMoney总优惠金额
                // this.couponCount === 0  可用优惠券数量 
                let afterPromTotalMoney = this.afterPromTotalMoney;
                let discountMoneyByCoupon = this.discountMoneyByCoupon;
                console.log(afterPromTotalMoney,discountMoneyByCoupon,'~~~~~~~~~优惠的金额信息～～～～～～～～～～～～～～～～')
                if(afterPromTotalMoney && discountMoneyByCoupon) {
                    this.couponFlag = '省'+ this.couponMoney +'元：'+'组合优惠';
                    // 省 元：优惠类型 优惠券优惠  活动优惠 组合优惠
				} else if(discountMoneyByCoupon && !afterPromTotalMoney){
                    this.couponFlag = '省'+ this.couponMoney +'元：'+'优惠券优惠';
				}else if(!discountMoneyByCoupon && afterPromTotalMoney){
                    this.couponFlag = '省'+ this.couponMoney +'元：'+'活动优惠';
                }else{
                     this.couponFlag = '';
                }
                //底部按钮和优惠券需要此事件
				this.$emit('changeTotalMoney',newVal)

//				return this.couponFlag;
				
            },
            changeGoodsMoney(newVal,oldVal){
                // 商品列表展示
                this.$emit('changeGoodsMoney',newVal);
            },
            couponCount(newVal,oldVal){
                // if(this.couponCount === 0) {
				// 	this.couponFlag = '';
				// } else {
				// 	this.couponFlag = "已选择";
				// }
            }
		},
		beforeDestroy() {
//			this.removeKeyCodeEventListener();
			var arr = [];
			this.setGiftSendArr(arr);
			this.setLadderIdList(arr);
			this.setGiftVOList(arr);
			hideLoading();
		},
		created() {
			if (this.checkPayBack()) return;
			//购物车有数据才去请求接口 否则不请求接口并跳入个人中心
            this.getMoneyAgain(true);  // 选择优惠券再次计算金额 获取商品数据 优惠券数据
    		// this.getToken();
			this.myNode = this.getMynode;  // 初始化用户留言
			this.innit();   //获取购物车数据
			// this.getCoupon();  //获取优惠券信息
			this.getSelectGiftList(); //获取满增阶梯信息 ladderList
			this.getSelectLadderList(); // 获取返利阶梯信息  ladderList
			this.getBuyMoreData(); // 获取 买增 信息  giftList
		},
		mounted() {
			setTimeout(() => {
				hideLoading();  
			},3000)
			console.log(document.getElementById('nodeBug'),'嚯嚯 ref')
//	        this.initTextareaFocusEvent();// 监听买家留言
	        //往本地存一个 地址
//	        var locationAdd = {
//	        	"province":"广东省",
//	        	"city":"深圳市",
//	        	"region":"宝安区",
//	        	"address":"平洲地铁",
//	        	"positionlat":102.35626,
//	        	"positionlng":33.25688,
//	        	"addressid":"-1"
//	        }
//	        localStorage.setItem('locationAdd', JSON.stringify(locationAdd));
	        // this.initStyle();
	    },
	}
</script>

<style scoped="scoped">
	.zxSettle_acount {
		height: 2.5rem;
		background: rgba(255, 255, 255, 0.9);
		width: 100%;
		border-top: 1px solid #eaeaea;
		/*padding: 0.5rem 0.75rem 0;*/
		line-height: 2.5rem;
		border-radius: 0px;
	}
	
	.scroller_list {
		overflow-y: auto;
	}
	
	.iscroll_list {
		height: 5.5rem !important;
	}
	
	.scroller_list {
		position: relative;
	}
	 .liuyan textarea {
        height: 3rem;
    }
    .canUseNum{
    	border: 1px solid red;
    	padding: 0.1rem;
    	font-size: 12px;
    	margin-left: 0.3rem;
    }
</style>